package Cn.Sarkar.MMS.Entities.Independent

import Cn.Sarkar.EntityDream.CoreEngine.RDBMS.Core.Extensions.hasOne
import Cn.Sarkar.EntityDream.CoreEngine.RDBMS.IDataContext
import Cn.Sarkar.MMS.DataBaseDefinations.Independent.Persons
import Cn.Sarkar.Entities.MMS.Additional.IContacts
import Cn.Sarkar.Entities.Common.Additional.IName
import Cn.Sarkar.MMS.Entities.Additional.Contact
import Cn.Sarkar.MMS.Entities.Additional.Name
import Cn.Sarkar.Entities.Common.BaseEntity
import Cn.Sarkar.Entities.MMS.Independent.IAccount
import Cn.Sarkar.Entities.MMS.Independent.IPerson
import org.joda.time.DateTime
import java.util.*

class Person(DataContext: IDataContext) : BaseEntity(DataContext, Persons), IPerson {
    override var idCardNumber: String by Persons.IDCardNumber
    var nameID by Persons.NameID
    override var name: IName by hasOne(Persons.NameID) { Name(it) }
    var contactID by Persons.ContactID
    override var contacts: IContacts by hasOne(Persons.ContactID) { Contact(it) }
    override var accounts: MutableList<IAccount> = LinkedList()
    override var birthDay: DateTime by Persons.BirthDay
}